#coding:UTF-8
import re
import urllib2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates
import datetime

def anaURL(url):
	Lt=[]
	Ld=[]
	Ltemp=[]
	try:
		fp = urllib2.urlopen(url)
	except:
		print 'open exception'
		return 0
	#op = open('1.txt','wb')
	pattern=re.compile(r'(?<=<td><div align="center">).*?(?=</td>)')
	L=pattern.findall(fp.read())
	
	j=10
	while(j<len(L)):
		Lt.append(float(L[j+1]))
		Ld.append(L[j])
		j+=9
	Ld.reverse()
	for i in range(0,len(Ld)):

		Ltemp.append(float(Ld[i][0:-3])+float(Ld[i][-2:])/60)
	Lt.reverse()
	plt.plot(Ltemp,Lt)
	#plt.xlable('x')
	#plt.ylable('y')
	plt.xlim(0,24)
	plt.grid()
	
	plt.title('t')
	plt.show()
	
	fp.close()
	print len(Ld)
	# print '\n'
	print len(Lt)
	#op.close()
	return 1

def getURL():
	date=raw_input('please input the date: ')
	anaURL('http://astro.wh.sdu.edu.cn/weatherdata/whao'+date+'.html')
	

	
	
def main():
	getURL()
	date1=datetime.date( 2003, 12, 1 )
	print date1
	
if __name__ == '__main__':
	main()